<?php

use think\facade\Route;

Route::group('/', function () {
    // 不需要登录验证的路由
    Route::post('login', 'Login/login');
    Route::get('logout', 'Login/logout');
})->middleware(['log']);

// 需要登录验证的路由组
Route::group('/', function () {
    // 用户信息
    Route::get('userInfo', 'UserInfo/index');

    // 管理员管理
    Route::group('admin', function () {
        Route::get('getList', 'Admin/getList');
        Route::post('doAdd', 'Admin/doAdd');
        Route::post('doEdit', 'Admin/doEdit');
        Route::post('doDelete', 'Admin/doDelete');
    });

    // 路由管理
    Route::group('router', function () {
        Route::get('getList', 'Router/getList');
    });

    // 角色管理
    Route::group('role', function () {
        Route::get('getList', 'Role/getList');
        Route::post('doAdd', 'Role/doAdd');
        Route::post('doEdit', 'Role/doEdit');
        Route::post('doDelete', 'Role/doDelete');
    });

    // 菜单管理
    Route::group('menu', function () {
        Route::get('getList', 'Menu/getList');
        Route::post('doAdd', 'Menu/doAdd');
        Route::post('doEdit', 'Menu/doEdit');
        Route::post('doDelete', 'Menu/doDelete');
        Route::get('getRouters', 'Menu/getRouters');
    });

    // 操作日志管理
    Route::group('operationLog', function () {
        Route::get('getList', 'OperationLog/getList');
        Route::get('getDetail', 'OperationLog/getDetail');
    });

    // OSS 文件管理路由组
    Route::group('oss', function () {
        Route::post('upload', 'Oss/upload');
        Route::get('getList', 'Oss/getList');
        Route::post('delete', 'Oss/delete');
        Route::post('deleteDir', 'Oss/deleteDir');
        Route::post('createFolder', 'Oss/createFolder');
        Route::get('getDownloadUrl', 'Oss/getDownloadUrl');
        Route::get('getFolderInfo', 'Oss/getFolderInfo');
        Route::get('getFileInfo', 'Oss/getFileInfo');
        Route::get('getPreviewUrl', 'Oss/getPreviewUrl');
    });

    // 语言管理
    Route::group('language', function () {
        Route::get('getList', 'Language/getList');
        Route::post('doAdd', 'Language/doAdd');
        Route::post('doEdit', 'Language/doEdit');
        Route::post('doDelete', 'Language/doDelete');
    });

    // 字典管理
    Route::group('dict', function () {
        Route::get('getList', 'Dict/getList');
        Route::post('doAdd', 'Dict/doAdd');
        Route::post('doEdit', 'Dict/doEdit');
        Route::post('doDelete', 'Dict/doDelete');
    });

    // 收藏相关
    Route::group('collect', function () {
        Route::get('list', 'Collect/list');
    });
    // Route::get('admin/user/list', 'admin/User/list'); 
    Route::group('user', function () {
        Route::get('list', 'User/list');
    });
    Route::group('searchproduct', function () {
        Route::get('list', 'SearchProduct/list');
        Route::get('detail', 'SearchProduct/detail');
        Route::post('delete', 'SearchProduct/delete');
        Route::post('batch_delete', 'SearchProduct/batchDelete');
    });
    Route::group('audioRecords', function () {
        Route::get('list', 'AudioRecords/list');
        Route::get('detail', 'AudioRecords/detail');
        Route::post('delete', 'AudioRecords/delete');
        Route::post('batch_delete', 'AudioRecords/batchDelete');
        Route::get('export', 'AudioRecords/export');
    });
    
// Route::get('admin/collect/list', 'admin/Collect/list');
// Route::post('admin/collect/delete', 'admin/Collect/delete');
})->middleware(['auth', 'log']);
